const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const port=3000
const app = express();
 
// 代理设置
const proxyOptions = {
  target: 'https://en.lsmaps.com', // 目标服务器地址
  changeOrigin: true, // 改变源地址
  pathRewrite: {
    '^/api': '', // 重写路径
  },
};
 
// 创建代理服务
const proxy = createProxyMiddleware('/api', proxyOptions);
 
// 使用代理中间件
app.use('/api', proxy);
 
// 启动服务器
app.listen(port, () => {
  console.log(`Proxy server is running on port ${port}`);
});